<template>
  <div class="refine_daytask">
    <!-- <router-view></router-view> -->
    <h2 class="titleblue">每日任务</h2>
    <div class="container">
      <get-task v-if="aadmin"></get-task>
      <!-- ulevel=='2'&&aadmin=='false'||businessOrg=='1'&&aadmin=='false'||aadmin=='false'&&isZfUser=='true' -->
      <send-task v-else></send-task>
    </div>
  </div>
</template>
<script>
  import GetEverydayTask from './GetEverydayTask'
  import SendEverydayTask from './SendEverydayTask'

  export default {
    components: {
      'send-task': SendEverydayTask,
      'get-task': GetEverydayTask,
    },
    data: function () {
      return {
        ulevel: 0,
        aadmin: false,
        businessOrg: localStorage.getItem('businessOrg'),
        isZfUser: localStorage.getItem('isZfUser')
      }
    },
    created () {
      // this.ulevel=localStorage.getItem('ulevel');
      // this.aadmin=localStorage.getItem('admin');
      // this.aadmin = this.$checkPermission('/everyday-task')
      let jurisdiction = this.$profile.userRoles, userFlag = 0, hsFlag = 0
      // if(this.$profile.olevel == 2){
      //   this.aadmin = true
      // }
      for(let item of jurisdiction){
        if(item.name == '派发任务权限' || item.name == '管理员' || item.name == '系统管理员'){
          userFlag += 1
        }else if(item.name == '海事执法人员'){
          hsFlag += 1
        }
      }
      if ((userFlag == 0 && this.$profile.olevel == 2) || (userFlag == 0 && this.$profile.organiza.businessOrg == 1)){
          this.aadmin = true
      } else if (userFlag > 0) {
          this.aadmin = false
      } else if (hsFlag == 1) {
          this.aadmin = true
      }
    },
    mounted () {

    },
    methods: {}
  }
</script>

<style scoped>
  .refine_daytask {
    width: 100%;
  }
</style>
